{layout name="public/layout" /}
{include file='yxnavbar'}
<style>
    .div_flex{
        display: flex !important;
    }
    .div_none{
        display: none; !important;
    }
    .shadow-box{
        width: 100%;
        height: 100%;
        position: fixed;
        top: 0;
        left: 0;
        background: rgba(0,0,0,0.5);
    }
    #alert_form {
        position: absolute;
        top: 10%;
        left: 30%;
        background: #fff;
        height: 80%;
        max-height: 700px;
    }
    .shadow-box .panel-body{
        max-height: 88%;
        overflow-y: auto;
    }
</style>
{include file='theme_menu'}



<style>
    .table td span{display:inline-block;margin-top:4px;}
    .table td input{margin-bottom:0;}
    .form-horizontal .form-group{
        margin-left: -15px;
        margin-right: -15px;
    }
    .form-group{
        margin-bottom: 30px;
        height: auto;
    }
    .demo{
        display:-webkit-box;
        display:-webkit-flex;
        display:-ms-flexbox;
        display:flex;
        -webkit-box-pack:justify;
        -webkit-justify-content:space-between;
        -ms-flex-pack:justify;
        justify-content:space-between;
    }

    .demo div{
        width:50%;
    }
    .ad_mq{
        display: none;
    }
</style>

<div class="tab-pane" id="adset">
    <div class="panel panel-default" role="tabpanel" style="">
        <div class="panel-heading">广告列表
        </div>
        <div style="display: flex;flex-direction: row;justify-content:space-around;">
            <!--					左侧列表-->
            <div class="panel-body table-responsive" style="width: 100%;">
                <table class="table table-hover">
                    <thead class="navbar-inner">
                    <tr>
                        <th style="width: 60px">序号</th>
                        <th style="width: 160px">广告图</th>
                        <th style="width: 270px;">广告动作</th>
                        <th style="width: 270px">广告有效期</th>
                        <th style="width: 240px">广告形式</th>
                        <th style="width: 160px">图片大小</th>
                        <th style="width: 160px">出现频率</th>
                        <th style="width: 160px">用户范围</th>
                        <th style="width: 240px">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {loop $list $index $row}
                    <tr>
                        <td>{php echo $index+1;}</td>
                        {if !($row['adshow']==3 || $row['adshow']==4)}
                        <td><img src="{$row['adimg']}" style="width: 70px;height: 70px;padding: 1px;"></td>
                        {else}
                        <td>
                            <a href="{$row['adimg']}" target="_blank">
                                <img src="https://css2020.yixuan.net/2020css/yx2020/images/video.png" style="width: 70px;height: 70px;padding: 1px;">
                            </a></td>
                        {/if}
                        <td style="word-break: break-all;">{php echo $adurl_name[$row['adurl']]?$adurl_name[$row['adurl']]:$row['adurl'];}</td>
                        <td>
                            {php echo date("Y-m-d H:i:s",$row['adbegintime']);}<br>{php echo date("Y-m-d H:i:s",$row['adendtime']);}
                        </td>
                        <td>
                            {$adshow_name[$row['adshow']]}
                        </td>
                        <td>
                            {$row['adsize']}%
                        </td>
                        <td>
                            {$row['adshownum']}</span>次
                        </td>
                        <td>
                            {$aduser_name_index[$row['aduser']]}
                            {php echo  $row['aduser']==3 || $row['aduser']==5?$row['quantity'].'人':'';}
                        </td>
                        <td>
                            <a class="btn btn-primary btn-sm" style="width: 35px" href="{php echo createWebUrl('ad', array('op' => 'get_one','themeid'=>$themeid,'id'=>$row['id']));}"
                               title="修改广告弹屏" data-toggle="tooltip" data-placement="top"><i class="fa fa-pencil-square-o"> </i></a>
                            <a class="btn btn-warning btn-sm" style="width: 35px" onclick="delItem(this)" data-id="{$row['id']}"
                               title="删除广告弹屏" data-toggle="tooltip" data-placement="top"><i class="fa fa-trash"> </i></a>
                        </td>
                    </tr>
                    {/loop}
                    </tbody>
                </table>
            </div>
        </div>

        <div class="panel-footer" >弹屏广告可用于活动提醒，开始转单提醒等</div>
    </div>
    <div class="col-sm-6" >
        <div class="col-sm-3">
            <input onclick="jumpAdd()" name="submit" id="btnConfirm" type="submit" value="添加图片广告" class="btn btn-primary col-lg-3" style="width:120px;">
        </div>
        <div class="col-sm-3">
            <input onclick="jumpAddVideo()" name="submit" id="btnConfirm" type="submit" value="添加视频广告" class="btn btn-primary col-lg-3" style="width:120px;">
        </div>
    </div>


    <!--修改-->
    <div class="shadow-box div_none" id="shadow-box" >
        <div class="panel panel-default" role="tabpanel" id="alert_form">
            <div class="panel-heading demo" >
                <div>弹屏广告修改</div>
                <div style="text-align: right;"><input name="button" onclick="closeAlert()" id="btnConfirm2" type="button" value="关闭" class="btn btn-danger col-lg-2" style="float: right"></div>
            </div>
            <div class="panel-body" style="z-index:188;display: flex;flex-direction: column;" >
                <form action="" method="post" class="form-horizontal" role="form" name="form" id="form" style="padding:10px;">
                    <input type="hidden" id="ad_id" name="id" value="{$id}"/>
                    <input type="hidden" name="themeid" value="{$themeid}"/>
                    {if !($item['adshow']==3 || $item['adshow']==4)}
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">弹屏广告</label>
                        <div class="col-sm-8 col-xs-12">
                            {php echo view_form_field_image('adimg',$item['adimg']);}
                            <span class="help-block">弹屏广告尺寸不限,最好为PNG或GIF动图，可设置透明底色</span>
                            <span class="help-block">居中大屏广告：建议尺寸1080*1701；底部横条广告：建议尺寸100*1008；右下角浮标：建议尺寸200*200</span>
                        </div>
                    </div>
                    {/if}
                    {if $item['adshow']==3 || $item['adshow']==4}
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">视频广告</label>
                        <div class="col-sm-8 col-xs-12">
                            {php echo view_form_field_video('advideo',$item['adimg']);}
                            <span class="help-block">精简视频，控制在90秒内为最佳，图文内容还可以放其它视频</span>
                        </div>
                    </div>
                    {/if}
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">广告动作</label>
                        <div class="col-sm-8 col-xs-12">
                            <div class="input-group">
                                <span class="input-group-addon">动作</span>
                                <select class="form-control" style="width: 140px;" name="adurl_type">
                                    <option value="" {if $item['adurl']=='' || !isset($adurl_name[$item['adurl']])}selected="selected"{/if}>自定义</option>
                                    {loop $adurl_name $key $value}
                                    <option value="{$key}" {if $item['adurl']==$key}selected="selected"{/if} >{$value}</option>
                                    {/loop}
                                </select>
                                <span class="input-group-addon">网址</span>
                                <input type="text" class="form-control"  placeholder="" name="adurl"  value="{$item['adurl']}">
                            </div>
                            <span class="help-block">小程序可以输入函数名调用函数，H5可以输入DO名称直接跳转也可输入URL跳转</span>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">广告有效期</label>
                        <div class="col-sm-8 col-xs-12">
                            {php echo view_form_field_daterange('adtime', array('start'=>date('Y-m-d H:i:s',$item['adbegintime']),'end'=>date('Y-m-d H:i:s',$item['adendtime'])), true);}
                            <span class="help-block">弹屏广告，只在有效期内打开活动链接才会出现</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">广告形式</label>
                        <div class="col-sm-5 col-xs-12">
                            <div class="input-group">
                                <span class="input-group-addon">位置</span>
                                <select class="form-control" style="width: 140px;" name="adshow" id="adshow">
                                    {if !($item['adshow']==3 || $item['adshow']==4)}
                                    <option value="0" {if $item['adshow']==0}selected="selected"{/if}>全屏弹窗</option>
                                    <option value="1" {if $item['adshow']==1}selected="selected"{/if} >底部横条</option>
                                    <option value="2" {if $item['adshow']==2}selected="selected"{/if} >右侧浮标</option>
                                    {/if}
                                    {if $item['adshow']==3 || $item['adshow']==4}
                                    <option value="3" {if $item['adshow']==3}selected="selected"{/if} >开屏视频</option>
                                    <option value="4" {if $item['adshow']==4}selected="selected"{/if} >全屏视频</option>
                                    {/if}
                                    <option value="5" {if $item['adshow']==5}selected="selected"{/if} >跑马灯文字广告-首图下</option>
                                    <option value="6" {if $item['adshow']==6}selected="selected"{/if} >跑马灯文字广告-首图上</option>
                                </select>
                                <span class="input-group-addon">大小</span>
                                <input type="text" style="width: 100px;" class="form-control" value="{if empty($item['adsize'])}100{else}{$item['adsize']}{/if}" name="adsize">
                            </div>
                        </div>
                    </div>
                    {if $item['adshow']==5 || $item['adshow']==6}
                    <!--跑马灯-->
                    <div class="form-group ad_mq" style="display: block;">
                        <label class="col-sm-2 col-xs-12 control-label">跑马灯文字广告滚动图标</label>
                        <div class="col-sm-8 col-xs-12">
                            {php echo view_form_field_image('ad_mq_icon',$item['ad_mq_icon']);}
                        </div>
                    </div>
                    <div class="form-group  ad_mq" style="display: block;">
                        <label class="col-sm-2 col-xs-12 control-label">跑马灯文字广告背景色</label>
                        <div class="col-sm-8 col-xs-12">
                            {php echo view_form_field_color('ad_mq_bg_color',$item['ad_mq_bg_color']);}
                        </div>
                    </div>
                    <div class="form-group  ad_mq" style="display: block;">
                        <label class="col-xs-8 col-sm-4 col-md-3 col-lg-2 control-label">跑马灯文字广告文字内容</label>
                        <div class="col-sm-8 col-xs-12">
                            <div class="input-group" style="width: 300px;">
                                <input  type="text"  class="form-control"  placeholder="请输入跑马灯文字广告文字内容" name="ad_mq_txt" value="{$item['ad_mq_txt']}">
                            </div>
                        </div>
                    </div>
                    <div class="form-group  ad_mq" style="display: block;">
                        <label class="col-xs-8 col-sm-4 col-md-3 col-lg-2 control-label">跑马灯文字广告文字大小</label>
                        <div class="col-sm-8 col-xs-12">
                            <div class="input-group" style="width: 300px;">
                                <input  type="text"  class="form-control"  placeholder="请输入跑马灯文字广告文字大小" name="ad_mq_txt_size" value="{$item['ad_mq_txt_size']}">
                            </div>
                        </div>
                    </div>
                    <div class="form-group  ad_mq" style="display: block;">
                        <label class="col-xs-8 col-sm-4 col-md-3 col-lg-2 control-label">跑马灯文字广告文字颜色</label>
                        <div class="col-sm-8 col-xs-12">
                            {php echo view_form_field_color('ad_mq_txt_color',$item['ad_mq_txt_color']);}
                        </div>
                    </div>
                    <!--跑马灯-->
                    {else}
                    <!--跑马灯-->
                    <div class="form-group ad_mq" style="display: none;">
                        <label class="col-sm-2 col-xs-12 control-label">跑马灯文字广告滚动图标</label>
                        <div class="col-sm-8 col-xs-12">
                            {php echo view_form_field_image('ad_mq_icon','');}
                        </div>
                    </div>
                    <div class="form-group  ad_mq" style="display: none;">
                        <label class="col-sm-2 col-xs-12 control-label">跑马灯文字广告背景色</label>
                        <div class="col-sm-8 col-xs-12">
                            {php echo view_form_field_color('ad_mq_bg_color','');}
                        </div>
                    </div>
                    <div class="form-group  ad_mq" style="display: none;">
                        <label class="col-xs-8 col-sm-4 col-md-3 col-lg-2 control-label">跑马灯文字广告文字内容</label>
                        <div class="col-sm-8 col-xs-12">
                            <div class="input-group" style="width: 300px;">
                                <input  type="text"  class="form-control"  placeholder="请输入跑马灯文字广告文字内容" name="ad_mq_txt" value="">
                            </div>
                        </div>
                    </div>
                    <div class="form-group  ad_mq" style="display: none;">
                        <label class="col-xs-8 col-sm-4 col-md-3 col-lg-2 control-label">跑马灯文字广告文字大小</label>
                        <div class="col-sm-8 col-xs-12">
                            <div class="input-group" style="width: 300px;">
                                <input  type="text"  class="form-control"  placeholder="请输入跑马灯文字广告文字大小" name="ad_mq_txt_size" value="">
                            </div>
                        </div>
                    </div>
                    <div class="form-group  ad_mq" style="display: none;">
                        <label class="col-xs-8 col-sm-4 col-md-3 col-lg-2 control-label">跑马灯文字广告文字颜色</label>
                        <div class="col-sm-8 col-xs-12">
                            {php echo view_form_field_color('ad_mq_txt_color','');}
                        </div>
                    </div>
                    <!--跑马灯-->
                    {/if}
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">出现频率</label>
                        <div class="col-sm-5 col-xs-12">
                            <div class="input-group">
                                <span class="input-group-addon">同一用户出现</span>
                                <input type="text" style="width: 70px;" class="form-control" value="{if empty($item['adshownum'])}999{else}{$item['adshownum']}{/if}" name="adshownum">
                                <span class="input-group-addon">次</span>
                                <select class="form-control"  style="width: 150px;" name="aduser">

                                    {loop $aduser_name $index $row}
                                    {if !empty($row)}
                                    <option value="{$index}" {if $item['aduser']==$index}selected="selected"{/if}>{$row}</option>
                                    {/if}
                                    {/loop}
                                </select>
                                <span class="input-group-addon">人数</span>
                                <input type="text" style="width: 70px;" class="form-control" value="{if empty($item['quantity'])}2{else}{$item['quantity']}{/if}" name="quantity">
                            </div>
                        </div>
                    </div>

                    <!--                启用底部自定义-->
                    <div class="form-group" id="ad_bottom_btn" >
                        <label class="col-sm-2 col-xs-12 control-label">底部按钮</label>
                        <div class="col-sm-5 col-xs-12">
                            <div class="input-group">
                                <label class="radio-inline">
                                    <input name="ad_bottom_btn" class="ad_bottom_btn" value="0" {if !$use_btm}checked{/if} type="radio"> 禁用
                                </label>
                                <label class="radio-inline">
                                    <input name="ad_bottom_btn" class="ad_bottom_btn" value="1" {if $use_btm}checked{/if} type="radio"> 启用
                                </label>
                            </div>
                        </div>
                    </div>
                    <div id="btm_btn_add"  style="{if !$use_btm}display: none;{/if}">

                        <div class="form-group" >
                            <label class="col-sm-2 col-xs-12 control-label">按钮1</label>
                            <div class="col-sm-6 col-xs-12">
                                <div class="input-group">
                                    <span class="input-group-addon">按扭文字</span>
                                    <input type="text" class="form-control"  placeholder="" name="ad_btm_txt[]"  value="{$ad_btm_txt[0]}">

                                </div>
                                <span class="help-block">按扭文字建议6个字符以内</span>
                                <!--                绑定优惠券-->
                                {if $coupon_total && $coupon_total>0}
                                <div class="input-group">
                                    <span class="input-group-addon">绑定优惠券</span>
                                    <select class="form-control" style="width: 300px;" name="ad_btm_coupon_id[]" >
                                        <option value="0" {if $ad_btm_coupon_id[0]==0 || !$ad_btm_coupon_id[0]} selected{/if}>请选择</option>
                                        {loop $coupon_list $row}
                                        <option value="{$row['id']}" {if $ad_btm_coupon_id[0] && $ad_btm_coupon_id[0]==$row['id']} selected{/if}>{$row['name']}</option>
                                        {/loop}
                                    </select>
                                </div>
                                {/if}
                                <!--                绑定优惠券-->
                                {php echo view_form_field_image('ad_btm_img[]',$ad_btm_img[0]);}
                                <span class="help-block">默认绑定广告动作的动作，按扭文字为空则不开启，图片为按扭背景图，<a href="https://css2020.yixuan.net/2020css/yx2020/images/ad_btn.png"  target="_blank">默认：https://css2020.yixuan.net/2020css/yx2020/images/ad_btn.png</a></span>
                            </div>
                        </div>
                        <div class="form-group" >
                            <label class="col-sm-2 col-xs-12 control-label">按钮2</label>
                            <div class="col-sm-6 col-xs-12">
                                <div class="input-group">
                                    <span class="input-group-addon">按扭文字</span>
                                    <input type="text" class="form-control"  placeholder="" name="ad_btm_txt[]"  value="{$ad_btm_txt[1]}">
                                </div>
                                <span class="help-block">按扭文字建议6个字符以内</span>
                                <!--                绑定优惠券-->
                                {if $coupon_total && $coupon_total>0}
                                <div class="input-group">
                                    <span class="input-group-addon">绑定优惠券</span>
                                    <select class="form-control" style="width: 300px;" name="ad_btm_coupon_id[]" >
                                        <option value="0" {if $ad_btm_coupon_id[1]==0 || !$ad_btm_coupon_id[1]} selected{/if}>请选择</option>
                                        {loop $coupon_list $row}
                                        <option value="{$row['id']}" {if $ad_btm_coupon_id[1] && $ad_btm_coupon_id[1]==$row['id']} selected{/if}>{$row['name']}</option>
                                        {/loop}
                                    </select>
                                </div>
                                {/if}
                                <!--                绑定优惠券-->
                                {php echo view_form_field_image('ad_btm_img[]',$ad_btm_img[1]);}
                                <span class="help-block">按扭文字为空则不开启，图片为按扭背景图，<a href="https://css2020.yixuan.net/2020css/yx2020/images/ad_btn.png"  target="_blank">默认：https://css2020.yixuan.net/2020css/yx2020/images/ad_btn.png</a></span>
                            </div>
                        </div>
                    </div>
                    <!--                启用底部自定义-->
                    <div class="form-group" id="sub_upload" >
                        <div class="col-sm-12">
                            <input name="submit" onclick="addOrEditItem()" id="btnConfirm" type="button" value="提交" class="btn btn-primary col-lg-2" style="float: left;width: 200px;">
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <!--新增-->
    <div class="shadow-box div_none" id="shadow-box1" >
        <div class="panel panel-default" role="tabpanel" id="alert_form">
            <div class="panel-heading demo" >
                <div>弹屏广告添加</div>
                <div><input name="button" onclick="closeAlert()" id="btnConfirm2" type="button" value="关闭" class="btn btn-danger col-lg-2" style="float: right" ></div>
            </div>
            <div class="panel-body" style="z-index:188;display: flex;flex-direction: column;" >
                <form action="" method="post" class="form-horizontal" role="form" name="form" id="form1" style="padding:10px;">
                    <input type="hidden" name="themeid" value="{$themeid}"/>
                    <div class="form-group" id="add_pic">
                        <label class="col-sm-2 col-xs-12 control-label">图片广告</label>
                        <div class="col-sm-8 col-xs-12">
                            {php echo view_form_field_image('adimg','');}
                            <span class="help-block">弹屏广告尺寸不限,最好为PNG或GIF动图，可设置透明底色</span>
                            <span class="help-block">居中大屏广告：建议尺寸1080*1701；底部横条广告：建议尺寸100*1008；右下角浮标：建议尺寸200*200</span>
                        </div>
                    </div>
                    <div class="form-group" id="add_video">
                        <label class="col-sm-2 col-xs-12 control-label">视频广告</label>
                        <div class="col-sm-8 col-xs-12">
                            {php echo view_form_field_video('advideo','');}
                            <span class="help-block">精简视频，控制在90秒内为最佳，图文内容还可以放其它视频</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">广告动作</label>
                        <div class="col-sm-8 col-xs-12">
                            <div class="input-group">
                                <span class="input-group-addon">动作</span>
                                <select class="form-control" style="width: 140px;" name="adurl_type">
                                    <option value="" >自定义</option>
                                    {loop $adurl_name $key $value}
                                    <option value="{$key}" >{$value}</option>
                                    {/loop}
                                </select>
                                <span class="input-group-addon">网址</span>
                                <input type="text" class="form-control"  placeholder="" name="adurl"  value="{$item['adurl']}">

                            </div>
                            <span class="help-block">小程序可以输入函数名调用函数，H5可以输入DO名称直接跳转也可输入URL跳转</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">广告有效期</label>
                        <div class="col-sm-8 col-xs-12">
                            {php echo view_form_field_daterange('adtime', array('start'=>$theme_bengin_time,'end'=>$theme_end_time), true);}
                            <span class="help-block">弹屏广告，只在有效期内打开活动链接才会出现</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">广告形式</label>
                        <div class="col-sm-5 col-xs-12">
                            <div class="input-group">
                                <span class="input-group-addon">位置</span>
                                <select class="form-control" style="width: 140px;" name="adshow" id="adshow_new">

                                </select>
                                <span class="input-group-addon">大小</span>
                                <input type="text" style="width: 100px;" class="form-control" value="100" name="adsize">
                            </div>
                        </div>
                    </div>

                    <!--跑马灯-->
                    <div class="form-group ad_mq">
                        <label class="col-sm-2 col-xs-12 control-label">跑马灯文字广告滚动图标</label>
                        <div class="col-sm-8 col-xs-12">
                            {php echo view_form_field_image('ad_mq_icon','');}
                        </div>
                    </div>
                    <div class="form-group  ad_mq">
                        <label class="col-sm-2 col-xs-12 control-label">跑马灯文字广告背景色</label>
                        <div class="col-sm-8 col-xs-12">
                            {php echo view_form_field_color('ad_mq_bg_color','');}
                        </div>
                    </div>
                    <div class="form-group  ad_mq">
                        <label class="col-xs-8 col-sm-4 col-md-3 col-lg-2 control-label">跑马灯文字广告文字内容</label>
                        <div class="col-sm-8 col-xs-12">
                            <div class="input-group" style="width: 300px;">
                                <input  type="text"  class="form-control"  placeholder="请输入跑马灯文字广告文字内容" name="ad_mq_txt" value="">
                            </div>
                        </div>
                    </div>
                    <div class="form-group  ad_mq">
                        <label class="col-xs-8 col-sm-4 col-md-3 col-lg-2 control-label">跑马灯文字广告文字大小</label>
                        <div class="col-sm-8 col-xs-12">
                            <div class="input-group" style="width: 300px;">
                                <input  type="text"  class="form-control"  placeholder="请输入跑马灯文字广告文字大小" name="ad_mq_txt_size" value="">
                            </div>
                        </div>
                    </div>
                    <div class="form-group  ad_mq">
                        <label class="col-xs-8 col-sm-4 col-md-3 col-lg-2 control-label">跑马灯文字广告文字颜色</label>
                        <div class="col-sm-8 col-xs-12">
                            {php echo view_form_field_color('ad_mq_txt_color','');}
                        </div>
                    </div>
                    <!--跑马灯-->
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">出现频率</label>
                        <div class="col-sm-5 col-xs-12">
                            <div class="input-group">
                                <span class="input-group-addon">同一用户出现</span>
                                <input type="text" style="width: 70px;" class="form-control" value="999" name="adshownum">
                                <span class="input-group-addon">次</span>
                                <select class="form-control"  style="width: 150px;" name="aduser">

                                    {loop $aduser_name $index $row}
                                    {if !empty($row)}
                                    <option value="{$index}" {if $item['aduser']==$index}selected="selected"{/if}>{$row}</option>
                                    {/if}
                                    {/loop}
                                    <!--                                拼团模式-->
                                    <span class="input-group-addon">人数</span>
                                    <input type="text" style="width: 70px;" class="form-control" value="{if empty($item['quantity'])}2{else}{$item['quantity']}{/if}" name="quantity">
                                </select>
                            </div>
                        </div>
                    </div>

                    <!--                启用底部自定义-->
                    <div class="form-group" id="ad_bottom_btn" >
                        <label class="col-sm-2 col-xs-12 control-label">底部按钮</label>
                        <div class="col-sm-5 col-xs-12">
                            <div class="input-group">
                                <label class="radio-inline">
                                    <input name="ad_bottom_btn" class="ad_bottom_btn2" value="0" checked type="radio"> 禁用
                                </label>
                                <label class="radio-inline">
                                    <input name="ad_bottom_btn" class="ad_bottom_btn2" value="1" type="radio"> 启用
                                </label>
                            </div>
                        </div>
                    </div>
                    <div id="btm_btn_add2"  style="display: none;">
                        <div class="form-group" >
                            <label class="col-sm-2 col-xs-12 control-label">按钮1</label>
                            <div class="col-sm-6 col-xs-12">
                                <div class="input-group">
                                    <span class="input-group-addon">按扭文字</span>
                                    <input type="text" class="form-control"  placeholder="" name="ad_btm_txt[]"  value="">
                                </div>
                                <span class="help-block">按扭文字建议6个字符以内</span>
                                <!--                绑定优惠券-->
                                {if $coupon_total && $coupon_total>0}
                                <div class="input-group">
                                    <span class="input-group-addon">绑定优惠券</span>
                                    <select class="form-control" style="width: 300px;" name="ad_btm_coupon_id[]" >
                                        <option value="0" >请选择</option>
                                        {loop $coupon_list $row}
                                        <option value="{$row['id']}" >{$row['name']}</option>
                                        {/loop}
                                    </select>
                                </div>
                                {/if}
                                <!--                绑定优惠券-->
                                {php echo view_form_field_image('ad_btm_img[]','');}
                                <span class="help-block">按扭文字为空则不开启，图片为按扭背景图，<a href="https://css2020.yixuan.net/2020css/yx2020/images/ad_btn.png"  target="_blank">默认：https://css2020.yixuan.net/2020css/yx2020/images/ad_btn.png</a></span>
                            </div>
                        </div>
                        <div class="form-group" >
                            <label class="col-sm-2 col-xs-12 control-label">按钮2</label>
                            <div class="col-sm-6 col-xs-12">
                                <div class="input-group">
                                    <span class="input-group-addon">按扭文字</span>
                                    <input type="text" class="form-control"  placeholder="" name="ad_btm_txt[]"  value="">
                                </div>
                                <span class="help-block">按扭文字建议6个字符以内</span>
                                <!--                绑定优惠券-->
                                {if $coupon_total && $coupon_total>0}
                                <div class="input-group">
                                    <span class="input-group-addon">绑定优惠券</span>
                                    <select class="form-control" style="width: 300px;" name="ad_btm_coupon_id[]" >
                                        <option value="0" >请选择</option>
                                        {loop $coupon_list $row}
                                        <option value="{$row['id']}" >{$row['name']}</option>
                                        {/loop}
                                    </select>
                                </div>
                                {/if}
                                <!--                绑定优惠券-->
                                {php echo view_form_field_image('ad_btm_img[]','');}
                                <span class="help-block">按扭文字为空则不开启，图片为按扭背景图，<a href="https://css2020.yixuan.net/2020css/yx2020/images/ad_btn.png"  target="_blank" >默认：https://css2020.yixuan.net/2020css/yx2020/images/ad_btn.png</a></span>
                            </div>
                        </div>
                    </div>
                    <!--                启用底部自定义-->

                    <div class="form-group" id="sub_upload" >
                        <div class="col-sm-12">

                            <input name="submit" onclick="addOrEditItem1()" id="btnConfirm" type="button" value="提交" class="btn btn-primary col-lg-2" style="float: left;    width: 200px;">

                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script>
    $(document).ready(function () {
        let op = "{php echo $op;}";
        if (op=='get_one'){
            $("#shadow-box").removeClass("div_none");
            $("#shadow-box").addClass("div_flex");
        }
        let select = $('select[name=adurl_type]');
        if(!select.val()) {
            select.next().css('display','table-cell');
            select.next().next().css('display','table-cell')
        }else {
            select.next().hide();
            select.next().next().hide()
        }

        select.on('change',function () {
            if(!$(this).val()) {
                $(this).next().css('display','table-cell');
                $(this).next().next().css('display','table-cell')
            }else {
                $(this).next().hide();
                $(this).next().next().hide();
            }
        })

        let select_person = $('select[name=aduser]');
        if(select_person.val() != 3 && select_person.val() != 5 ) {
            select_person.next().hide();
            select_person.next().next().hide()
        } else {
            select_person.next().css('display','table-cell');
            select_person.next().next().css('display','table-cell')
        }

        select_person.on('change',function () {
            console.log($(this).val())
            if($(this).val() == 3 || $(this).val() == 5) {
                $(this).next().css('display','table-cell');
                $(this).next().next().css('display','table-cell')
            }else {
                $(this).next().hide();
                $(this).next().next().hide();
            }
        })

    });
    <!--    弹出表单-->
    function closeAlert() {
        $("#ad_id").val = '';
        $("#shadow-box").removeClass("div_flex");
        $("#shadow-box").addClass("div_none");
        $("#shadow-box1").removeClass("div_flex");
        $("#shadow-box1").addClass("div_none");
    }
    //修改奖品 提交数据
    function addOrEditItem() {
        var list_total = "{php echo $total;}";
        let postUrl = "{php echo createWebUrl('ad',array('themeid'=>$themeid,'op'=>'edit'));}";
        let success_redirect = "{php echo createWebUrl('ad',array('themeid'=>$themeid,'op'=>'display'));}";
        let formData = $("#form").serialize();
        $.ajax({
            url:postUrl,
            dataType:'json',
            method:'post',
            data:formData,
            success:function (e) {
                let status = e.status;
                let result = e.result;
                if (status!=1){
                    layer.msg(result.msg)
                }else{
                    layer.msg(result.msg);
                    window.location.href = success_redirect;
                }
            },
            fail:function (err) {
                console.log(err)
            }
        })
    }
    //新增奖品 提交数据
    function addOrEditItem1() {
        let postUrl = "{php echo createWebUrl('ad',array('themeid'=>$themeid,'op'=>'edit'));}";
        let success_redirect = "{php echo createWebUrl('ad',array('themeid'=>$themeid,'op'=>'display'));}";
        let formData = $("#form1").serialize();
        $.ajax({
            url:postUrl,
            dataType:'json',
            method:'post',
            data:formData,
            success:function (e) {
                let status = e.status;
                let result = e.result;
                if (status!=1){
                    layer.msg(result.msg)
                }else{
                    layer.msg(result.msg);
                    window.location.href = success_redirect;
                }
            },
            fail:function (err) {
                console.log(err)
            }
        })
    }
    //跳转新增
    function jumpAdd(){
        $("#shadow-box1").removeClass("div_none");
        $("#shadow-box1").addClass("div_flex");
        $("#add_pic").removeClass("div_none");
        $("#add_pic").addClass("div_flex");
        $("#add_video").removeClass("div_flex");
        $("#add_video").addClass("div_none");
        $("#adshow_new").html('<option value=\"0\" >全屏弹窗</option><option value=\"1\" >底部横条</option><option value=\"2\" >右侧浮标</option><option value=\"5\" >跑马灯文字广告-首图下</option><option value=\"6\" >跑马灯文字广告-首图上</option>');
    }
    function jumpAddVideo(){
        $("#ad_bottom_btn").hide();
        $("#shadow-box1").removeClass("div_none");
        $("#shadow-box1").addClass("div_flex");
        $("#add_video").removeClass("div_none");
        $("#add_video").addClass("div_flex");
        $("#add_pic").removeClass("div_flex");
        $("#add_pic").addClass("div_none");
        $("#adshow_new").html('<option value=\"3\" >开屏视频</option><option value=\"4\" >全屏视频</option>');
    }
    function delItem(e)
    {
        let id  = e.getAttribute("data-id");
        if (id){
            postUrl = "{php echo createWebUrl('ad',array('themeid'=>$themeid,'op'=>'del'));}";
            let success_redirect = "{php echo createWebUrl('ad',array('themeid'=>$themeid,'op'=>'display'));}";
            $.ajax({
                url:postUrl,
                dataType:'json',
                method:'post',
                data:{id:id},
                success:function (e) {
                    let status = e.status;
                    let result = e.result;
                    if (status!=1){
                        layer.msg(result.msg)
                    }else{
                        layer.msg(result.msg);
                        window.location.href = success_redirect;
                    }
                },
                fail:function (err) {
                    console.log(err)
                }
            })
        }

    }
    //切换跑马灯
    $("#adshow,#adshow_new").change(function () {
        console.log('修改')
        let tmp_val = $(this).val();
        if (tmp_val==5){
            $(".ad_mq").show();
        }else{
            $(".ad_mq").hide();
        }
        if (tmp_val!=0){
            $("#ad_bottom_btn").hide();
            $("#btm_btn_add").hide();
        }else{
            $("#ad_bottom_btn").show();
        }
    });
    //底部按钮切换 新增
    $('input:radio[name="ad_bottom_btn"]').change(function () {
        var cut_val = $(this).val();
        if (cut_val==1){
            $("#btm_btn_add").show();
        }else{
            $("#btm_btn_add").hide();
        }
    });
    //修改
    $('input:radio[class="ad_bottom_btn2"]').change(function () {
        var cut_val = $(this).val();
        if (cut_val==1){
            $("#btm_btn_add2").show();
        }else{
            $("#btm_btn_add2").hide();
        }
    });
</script>
<script type="text/javascript">
    function submitForm(){
        var form = document.getElementById("myform");
        form.submit();
    }
</script>